package com.mdtx.entity;

import com.mdtx.utils.ConvertUtil;

import java.util.Date;

/**
 * 类的属性
 *
 * @author zhgz
 * @create 2017-07-23 18:24
 **/
public class ClassAttribute extends TableAttribute{

    /**
     * 包路径
     */
    private String packagePath;
    /**
     * 类名
     */
    private String className;

    /**
     * 作者
     */
    private String author;

    /**
     * 时间
     */
    private Date date;


    public String getPackagePath() {
        return packagePath;
    }

    public void setPackagePath(String packagePath) {
        this.packagePath = packagePath;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }


    public String getClassName() {

        return ConvertUtil.toCamelCasing(super.getTableName(),true);
    }

    public void setClassName(String className) {
        this.className = className;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ClassAttribute that = (ClassAttribute) o;

        if (!packagePath.equals(that.packagePath)) return false;
        return className.equals(that.className);
    }

    @Override
    public int hashCode() {
        int result = packagePath.hashCode();
        result = 31 * result + className.hashCode();
        return result;
    }

    @Override
    public String toString() {
        StringBuffer str = new StringBuffer();
        str.append("ClassAttribute{").append(" packagePath=").append(packagePath)
                .append(", className=").append(className).append("}");
        return str.toString();
    }
}
